
#include <QtNetwork>
#include <QApplication>
#include <QTranslator>

#include <callback.h>
#include <parse.h>




int main(int argc, char **argv) {


  QApplication app(argc, argv);

  QTranslator qtTranslator;
  qtTranslator.load("gqsync."+ QLocale::system().name(),"./"); 
  app.installTranslator(&qtTranslator);

  Callback c ;
  QHttp http;

  QString email = argv[1];
  QString passw = argv[2];

  c.http = &http;

  QHttpRequestHeader header("POST", "https://www.google.com/accounts/ClientLogin");
  header.setValue("Host", "google.com");
   
  http.setHost("google.com");
  header.setValue( "User-Agent", "User Agent");
  header.setContentType("application/x-www-form-urlencoded");
  QString searchString = 
    "Email=" + email +
    "&Passwd=" + passw + 
    "&accountType=GOOGLE&service=cp";

  http.request(header,searchString.toUtf8());
   

  QObject::connect(&http, SIGNAL(requestFinished(int, bool)),
                  &c,SLOT(authReq(int, bool)));

  return app.exec();


}
